<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="renderer" content="webkit"> 
		<meta content="always" name="referrer">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>首页</title>
		<!--[if lt IE 9]>
			<script type="text/javascript">
				window.location.href = "tip.html"
			</script>
		<![endif]-->
		<link rel="stylesheet" type="text/css" href="css/login.css" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<link rel="stylesheet" href="css/swiper.min.css">
		<link rel="stylesheet" type="text/css" href="css/set_ad.css" />
		<link rel="stylesheet" href="css/layui.css">
		<script type="text/javascript" src="js/jquery.min.js" ></script>
		<script src="lib/layui/layui.js"></script>
		<script src="js/fsbanner.js"></script>
		<script src="js/ajaxSet.js"></script>
		<style>
			.asd{
				transform: translateY(-5px)!important;
				transition: linear all 0.2s!important; 
    			box-shadow: 5px 5px 20px 5px rgba(0,0,0,0.5)!important;
			}
			.Hotel .h_c{
				padding:0;
			}
			.Hotel .h_c li{
				width: 285px;
				box-sizing: border-box;
			}
			.Hotel .h_c li a{
				text-align: center;
			}
			.Hotel .h_c li .newsMoney{
				font-size: 24px!important;
			}
			.Hotel .h_c li i{
				font-size: 16px;
			}
			.Hotel .h_c li img{
				width: 100%;
				height: 187px;
			}
			.Hotel .h_c li p {
			    font-size: 22px;
			    height: 28px;
			    line-height: 28px;
			}
			.Hotel .h_c li .newsMoney {
			    font-size: 18px;
			    height: 28px;
			    color: #f00;
			    line-height: 28px;
			}
			.Hotel .h_c_pic ul.three li{
				width: 375px;
				height: 274px;
			}
			.Hotel .h_c_pic ul.three li img{
				width: 375px;
				height: 274px;
			}
			#hot li a {
				overflow: hidden;
			}
			.header .w_1190{position: relative;}
			.header .w_1190 .h_left b{position: absolute; top:50%; margin-top: -9px; margin-right: 5px; width: 20px;height: 16px; }
			.header .w_1190 .h_left b ul{position: absolute}
			.header .w_1190 .bhover{min-width: 200px;z-index:9999; height: 70px; background-color: #fff;position: absolute; top: 20px; left: -45px; border-radius: 4px;padding: 10px;box-shadow: 0 0 5px #f1f1f1;}
			.header .w_1190 .bhover span:last-child{color: #f40;font-size: 21px;font-weight: 700; margin:0 3px;}
			.header .w_1190 .bhover li{height: 22px;line-height: 22px;}
			#userName{
				float: left;
				width: 75px;
				text-align: center;
				position: relative;
				cursor: pointer;
				display: none;
			}
			#userName li:after{
				display:block;
				content:"";
				visibility:hidden;
				height:0;
				border-bottom:  1px solid #000000;
			}
			#userName dl{
				top: 42px;
				width: 100%;
				position: absolute;
				display: none;
				background: #fff;
				z-index: 9999;
			}
		</style>
	</head>
	<body style="min-width: 1360px;">
		<!-- 顶部导航 -->
<!-- 回到顶部 -->
<div class="go_top1 dn" id="go_top">
	<a href="javascript:;" class="go"></a>
</div>
<!-- 顶部 -->
<div class="header">
	<div class="w_1190">
		<div class="h_right fr">
			<a href="index.html">YIXA首页</a>
			<a href="dingdan.html">我的订单</a>
			<a href="zhanghu.html">账户设置</a>
			<a href="about.html">关于我们</a>
		</div>
		<div class="h_left">
			<ul id="userName">
				<li>111111</li>
				<dl>
					<dd>退出登录</dd>
				</dl>
			</ul>
			<!-- 未登录 -->
				<a href="login.html" class="c_01afff" id="login">登录</a>
				<a href="register.html" class="registerno">免费注册</a>
			<!-- 已登录 -->
		</div>
	</div>
</div>
<script type="text/javascript">
	
layui.use(['layer'], function() {
	
	$("#userName").on("click",function(){
	    $(this).find("dl").slideToggle(200)
	})
	
	$("#userName dd").on("click",function(){
	    $.ajax({
	    	type:"post",
	    	url:"http://52lvu.cn:8080/api/login/logout",
	        data:{
	            userId : token.userId
	        },success : function (result){
	            if (result.resultCode == 200) {
	            	localStorage.removeItem("token");
	            	window.location.href="login.html"
	            }
	        },error : function (e){
	            layer.msg("请求错误，请稍后重试",{icon:2,time:2000})
	        }
	    });
	})
	
	var token = JSON.parse(localStorage.getItem('token'));
	
	if (token) {
		var expiredTime = 1800000;
		var loginTime = token.loginTime
		var nowTime = new Date().getTime();

		
		if ( (nowTime - loginTime) > expiredTime ) {
			localStorage.removeItem("token");
			window.location.href = "login.html";
		}else{
			$("#userName").show(); 
			$(".registerno").hide();
			$("#login").hide()
			$("#userName li").html(token.userName)
		}
	}else{
	    window.location.href="login.html";
	}
})
</script>
<!-- 回到顶部 -->
<div class="go_top dn" id="go_top">
    <a href="javascript:;" class="go"></a>
</div>
<!-- banner -->
<div class="main_col">
	<div class="menu_overseas">
		<div class="w_1200">
			<a href="index.html" class="lion">首页</a>
			<a href="searchList.html?search=" class="lion" style="margin-left: 5px;"	>帕劳酒店</a>
			<a href="searchList.html?type=0" class="lion" style="margin-left: 5px;">推荐酒店</a>
			<a href="searchList.html?type=1" class="lion" style="margin-left: 5px;">热销酒店</a>
		</div>
	</div>
    <form id="hotelSearchForm">
        <div class="mc_search" style="height: 240px;">
            <ul>
                <input type = "hidden" id="cityCode" name="cityCode" value="SZX">
                <input type = "hidden" name="pageNo" value = "1"/>
                <input type = "hidden" name = "pageSize" value = "15"/>
				<li>
					<div class="ms_title">酒店名称</div>
					<dl >
						<dd style="width: 280px;	">
							<input type="text" style="border: none;width: 100%;height: 100%;line-height: 38px;height: 38px;" placeholder="输入酒店名称进行查询	" id="hotelName">
						</dd>
					</dl>
					<div class="dcancel">×</div>
					<div class="date text"></div>
				</li>
                <li>
                    <div class="ms_title">入住时间</div>
                    <dl>
                    	<dd class="w_50 ">入住</dd>
                        <dd>
							<div class="layui-inline">
								<div class="layui-input-inline">
									<input type="text" class="layui-input" id="comedata1" value="2018-03-09"  style="border: none;width: 230px;" readonly="readonly">
								</div>
							</div>
                        </dd>
                    </dl>
                    <div class="dcancel">×</div>
                    <div class="date text"></div>
                </li>
                <li>
                    <div class="ms_title">离开时间</div>
                    <dl>
                    	<dd class="w_50 ">离店</dd>
                        <dd>
							<div class="layui-inline">
								<div class="layui-input-inline">
									<input type="text" class="layui-input" id="leveData1" value="2018-03-09" lay-key="2" style="border: none;width: 230px;"readonly="readonly">
								</div>
							</div>
                        </dd>
                 
                    </dl>
                    <div class="dcancel">×</div>
                    <div class="date text"></div>
                </li>
                <li class="ms_btn">
                    <a id="toHotelList">
                        <i class='btnLoading'></i>
                        <em>立即查询</em>
                    </a>
                </li>
            </ul>
        </div>
        </form>
    <div class="mc_img">
    	<div class="layui-carousel" id="test1">
		  	<div carousel-item id="bannerList">
		    
		  	</div>
		</div>

    </div>
</div>
<!--手风琴-->
<p class="tit" style="font-size: 30px;margin-top: 70px;text-align: center;margin-bottom: 55px;" id="rxjd">推荐酒店</p>
<div class='ex' name='6' style="margin-top: 80px;">
    <div class='fsbanner' style="width: 1190px;display: block;" id="ex">
       
    </div>
</div>

<!-- 热销酒店 & 度假优选 -->

<div class="w-1200 Hotel">

	<!--热销酒店-->

	<p class="tit" style="font-size: 30px;margin-top: 70px;text-align: center;margin-bottom: 55px;" id="ptjd">热销酒店</p>

	<div class="h_c clearfloat" style="overflow: inherit;" >
        <ul id="hot">
        
        </ul>
    </div>
</div>
<div id="qq">
	
</div>
<div id="footer">
	
</div>
</body>
</html>
<script>
	$(".dateS").click(function(){
		$(".graybg").show();
	});
	$("#qq").load("lib/qq.html");$("#footer").load("lib/footer.html");
</script>
<script src="js/wang.js" type="text/javascript" charset="utf-8"></script>
<script>
    
    layui.use(['form', 'layedit', 'laydate','element','carousel'], function() {
        var form = layui.form, 
            layer = layui.layer, 
            layedit = layui.layedit, 
            laydate = layui.laydate, 
            element = layui.element,
            carousel = layui.carousel;

		$("#comedata1").val(wang.getData())
		$("#leveData1").val(wang.getData(0,0,1))
		
		var a = laydate.render({
            elem: '#comedata1',
            theme: '#ff660c',
             min : wang.getData(0,0,1),
            done: function(value, date, endDate) {
				b.config.min = {
					year: date.year,
					month: date.month - 1,
					date: date.date+1,
				}
				var val = new Date(value);
				var n = val.getTime() + 1 * 24 * 60 * 60 * 1000;
    			var result = new Date(n);
				$("#leveData1").val(result.getFullYear() + "-" + wang.toDub((result.getMonth() + 1)) + "-" + wang.toDub(result.getDate()))
			}
        });
        var b = laydate.render({
            elem: '#leveData1',
            theme: '#ff660c',
            min : wang.getData(0,0,2)
        });
//	banner
		$.ajax({
			type:"post",
			url:"http://52lvu.cn:8080/api/banner/bannerAll",
			success:function(result){

				var data = result.data;
				
				for (i = 0 ; i < data.length ; i++) {
					$("#bannerList").append("<div><img src='http://52lvu.cn:8080/hotel/upload"+data[i].picUrl+"' /></div>")
				}
				  carousel.render({
				    elem: '#test1'
				    ,width: '100%' //设置容器宽度
				    ,height:"100%"
				    ,arrow: 'always' //始终显示箭头
				    ,anim: 'default' //切换动画方式
				    ,interval : '5000'
				  });

			},error:function (){
				layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
			}  
		});
		
		$("#toHotelList").on("click",function(){
		    var name = $("#hotelName").val(),
		    	comedata = $("#comedata1").val(),
		    	leveData1 = $("#leveData1").val();
		    	
	    	var searchList = {
	    		name : $("#hotelName").val(),
	    		startTime : $("#comedata1").val(),
	    		endTime : $("#leveData1").val()
	    	};
	    	
	    	$.ajax({
	    	    type:"post",
	    	    url:"http://52lvu.cn:8080/api/hotel/getList",
	    	    beforeSend: function(xhr) {
			        xhr.setRequestHeader("Content-Type", "application/json");
				},
	    	    data:JSON.stringify(searchList),
	    	    success : function (result){

	    			if (result.resultCode!=200) {
	    				layer.msg("未查询到数据，请您更改搜索条件后重试",{icon:2,time:2000})
	    			} else{
	    				window.location.href = "searchList.html?search="+window.btoa(wang.encodeURI(name))
	    			}
	    	    },error : function (e){
	    	        layer.msg("未查询到数据，请您更改搜索条件后重试",{icon:2,time:2000})
	    	    }
	    	});
		})
    
    	// 手风琴
		var hotList = {
			name : ""
		}
		$.ajax({
	        type:"post",
	        url:"http://52lvu.cn:8080/api/hotHotel/hotHotel",
			beforeSend: function(xhr) {
		        xhr.setRequestHeader("Content-Type", "application/json");
			},
			data : JSON.stringify(hotList),
	        success : function (result){

				var data = result.data
	            
	            for( i = 0 ; i < data.length && i < 6; i++){
	            	var pic = data[i].picture.split(";")
	            	$("#ex").append("<div style='background-image: url(http://52lvu.cn:8080/upload"+
					data[i].coverPic+");background-size:100% 100%;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader ( enabled=true ,sizingMethod=scale, src=/upload"+
					pic[1]+" )'><a class='fsbanner_a01' href='info.html?id="+
	            	data[i].hotelId+"&hotelId="+data[i].id+"'></a></div>")
	            }
	            
				$('#ex').fsBanner({
			        trigger: 'mouse'
			    });
	              
	        },error : function (e){
	            layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
	        }
	    });	
	    
	    //热销酒店
		
	    $.ajax({
	        type:"post",
	        url:"http://52lvu.cn:8080/api/hotel/bannerHotel",
	        success : function (result){

	    		var data = result.data;
	    		
	    		for ( i = 0 ; i < data.length ; i++) {
	    			if ( ( i + 1 ) % 4 == 0) {
	    				
	    				if (data[i].pricture) {
	    					data[i].minPrice == null ? data[i].minPrice ="暂无" : data[i].minPrice = data[i].minPrice ;
	    					var pic = data[i].pricture.split(";")
	    					$("#hot").append("<li class='m_r0' ><a href='info.html?id="+
		    				data[i].id+"' class='index_ba'><img src='http://52lvu.cn:8080/upload"+
			    			pic[0]+"' /><p class='newsName' title='"+data[i].name+"'>"+
			    			data[i].name+"</p><p class='newsMoney'>"+data[i].minPrice+"<i>元起</i></p></a></li>")
	    				}else{
	    					data[i].minPrice == null ? data[i].minPrice ="暂无" : data[i].minPrice = data[i].minPrice ;
	    					$("#hot").append("<li class='m_r0' ><a href='info.html?id="+
		    				data[i].id+"' class='index_ba'><img src='http://52lvu.cn:8080/upload"+
			    			data[i].pricture+"' /><p class='newsName' title='"+data[i].name+"'>"+
			    			data[i].name+"</p><p class='newsMoney'>"+data[i].minPrice+"<i>元起</i></p></a></li>")
	    				}
	    			} else{
	    				if (data[i].pricture) {
	    					data[i].minPrice == null ? data[i].minPrice ="暂无" : data[i].minPrice = data[i].minPrice ;
	    					var pic = data[i].pricture.split(";")
		    				$("#hot").append("<li><a href='info.html?id="+
		    				data[i].id+"' class='index_ba'><img src='http://52lvu.cn:8080/upload"+
			    			pic[0]+"' /><p class='newsName' title='"+data[i].name+"'>"+
			    			data[i].name+"</p><p class='newsMoney'>"+data[i].minPrice+"<i>元起</i></p></a></li>")
	    				}else{
	    					data[i].minPrice == null ? data[i].minPrice ="暂无" : data[i].minPrice = data[i].minPrice ;
		    				$("#hot").append("<li><a href='info.html?id="+
		    				data[i].id+"' class='index_ba'><img src='http://52lvu.cn:8080/upload"+
			    			data[i].pricture+"' /><p class='newsName' title='"+data[i].name+"'>"+
			    			data[i].name+"</p><p class=''>"+
			    			data[i].minPrice+"<i>元起</i></p></a></li>")
	    				}
	    			}
	    		}
	    		
	    		$(".h_c li").on("mouseover",function (){
					$(this).addClass("asd")
				}).on("mouseout",function (){
					$(this).removeClass("asd")
				})
	            
	        },error : function (e){
	            layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
	        }
	    });
    });
</script>
